import { Config, Inject, Provide } from '@midwayjs/decorator';
import { BaseService, CoolCommException } from '@cool-midway/core';
import { MangoRequestService } from './request';

/**
 * 城市
 */
@Provide()
export class MangoOrderService extends BaseService {
  @Inject()
  mangoRequestService: MangoRequestService;

  @Config('module.mango')
  coolConfig;

  /**
   * 创建订单
   */
  async createOrder(data) {
    const url = '/api/622c5d0a77467';
    try {
      return await this.mangoRequestService.post(url, data);
    } catch (error) {
      throw new CoolCommException(error.message);
    }
  }
  //立即下单
  async confirmOrder(data) {
    const url = '/api/623a8fc6691fe';
    try {
      return await this.mangoRequestService.post(url, data);
    } catch (error) {
      throw new CoolCommException(error.message);
    }
  }
  //更新查询订单详情
  async updateDetail(data) {
    const url = '/api/623829f7a2be4';
    try {
      return await this.mangoRequestService.post(url, data);
    } catch (error) {
      throw new CoolCommException(error.message);
    }
  }
}
